package com.mxpio.erp.technology.service.impl;

import com.mxpio.erp.common.technology.entity.StandTecRout;
import com.mxpio.erp.common.technology.entity.StandTecRoutProc;
import com.mxpio.erp.common.technology.service.StandTecRoutService;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wupaa
 */
@Service
public class StandTecRoutServiceImpl extends BaseServiceImpl<StandTecRout> implements StandTecRoutService {
    @Override
    @Transactional(readOnly = true)
    public StandTecRout getById(String routCode) {
        List<StandTecRout> list = JpaUtil.linq(StandTecRout.class).collect("routCode", StandTecRoutProc.class, "routCode").equal("routCode", routCode).list();
        if (CollectionUtils.isEmpty(list)){
            return null;
        }
        return list.get(0);
    }
}
